package com.sky.config;

import com.sky.properties.WeChatProperties;
import com.sky.utils.WeChatLoginUtil;
import com.sky.utils.WeChatPayUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * wechatpay配置类
 */
@Configuration
@Slf4j
public class WeChatConfiguration {
    @Bean
    @ConditionalOnMissingBean //条件对象当没有这个类的时候就会去创建此类
    public WeChatPayUtil weChatPayUtil(WeChatProperties weChatProperties) {

        log.info("weChatProperties配置参数为:{}", weChatProperties);
       return new WeChatPayUtil(
//               weChatProperties.getAppid(),
//               weChatProperties.getSecret(),
//               weChatProperties.getMchid(),
//               weChatProperties.getMchSerialNo(),
//               weChatProperties.getPrivateKeyFilePath(),
//               weChatProperties.getApiV3Key(),
//               weChatProperties.getWeChatPayCertFilePath(),
//               weChatProperties.getNotifyUrl(),
//               weChatProperties.getRefundNotifyUrl()
       );

    }
}

